package com.example.test.factory.simpleFactory;

/**
 * @author 晓果冻
 * @version 1.0
 * @date 2021/11/2 21:51
 */
public class SimplePayFactory {

    /**
     * 根据参数返回对应支付方式
     *
     * @param type
     * @return
     */
    public static Pay creatPay(String type) {
        if (type == null) {
            return null;
        } else if ("WeChat".equals(type)) {
            return new WeChatPay();
        } else if ("AliPay".equals(type)) {
            return new AliPay();
        } else {
            return null;
        }
    }
}
